<?
	$title="Edit Profiles";
	
	require("required/dbconnect.php"); 
	require("required/function.php"); 
	 
	$id=$_POST['id'];
	$name=$_POST['name'];
	$sex=$_POST['sex'];
	$member_type=$_POST['member_type'];
	$membership_number=$_POST['membership_number'];
	$membership_number_current=$_POST['membership_number_current'];
	
	$chk=mysql_query("select count(*) as result from os_member where membership_number<>'$membership_number_current' and membership_number='$membership_number'");
	
	if(mysql_result($chk,0,"result")==0)
	{	
	
		$hpnumber=$_POST['hpnumber'];
		
		$address1=$_POST['address1'];
		$address2=$_POST['address2'];
		$postcode=$_POST['postcode'];
		$city=$_POST['city'];
		$state=$_POST['state'];
	
			
		$update=mysql_query("update os_member set name='$name',gender='$sex',member_type='$member_type',membership_number='$membership_number',
							 hpnumber='$hpnumber',address1='$address1',address2='$address2',postcode='$postcode',city='$city',state='$state' 
							 where id=$id")or die(mysql_error());
	
		header("Location:member_viewfull.php?id=$id&action=3");
	}else{
		header("Location:member_edit.php?id=$id&action=1");
	}
?>
			
			